-
-
Notifications
You must be signed in to change notification settings - Fork 195
NW7 | Jovy_So | Structuring-and-Testing-Data | WEEK 1 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see you've worked super hard on thinking about these questions, @jovyso . 💪 Keep going!
@@ -1,5 +1,5 @@ | |||
// Currently trying to print the string "I was born in Bolton" but it isn't working... | |||
// what's the error ? | |||
|
|||
console.log(`I was born in ${cityOfBirth}`); | |||
const cityOfBirth = "Bolton"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write in comments don't just fix the code. Thanks!
@@ -1,4 +1,4 @@ | |||
const cardNumber = 4533787178994213; | |||
const cardNumber = "4533787178994213"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a good solution do you think? What might the consequences be in changing a number to a string?
//const 24hourClockTime = "08:53"; | ||
|
||
function convert12To24(time) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what the exercise asked for? Take another look
|
||
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer | ||
It works for non-negative values of movieLength. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a movie have a negative length?
Now enter just `console` in the Console, what output do you get back? | ||
|
||
-->Answer: console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what is this showing you?
Try also entering `typeof console` | ||
|
||
-->Answer: 'object' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What conclusion can you draw from this?
@@ -25,3 +25,9 @@ console.log(`£${pounds}.${pence}`); | |||
|
|||
// To begin, we can start with | |||
// 1. const penceString = "399p": initialises a string variable with the value "399p" | |||
// 2. const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1): remove "p" | |||
// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"): Pad the pence number string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does pad mean? What is it doing?
// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"): Pad the pence number string | ||
// 4. const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2): Extract pounds | ||
// 5. const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0");: Extract pence | ||
// 6. console.log(`£${pounds}.${pence}`);: Output the Result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's logging something. Is this the same as outputting a result?
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.